home *** CD-ROM | disk | FTP | other *** search
/ Language/OS - Multiplatform Resource Library / LANGUAGE OS.iso / parallel / descript.c < prev    next >
Text File  |  1992-04-11  |  2KB  |  49 lines

  1. /*-------------------------------------------------------------------*/
  2. /*----Upgrade to predio.c in muProlog to get access to file          */
  3. /*----descriptors associated with channels. Needs additions to init.c*/
  4. /*----and init.h :                                                   */
  5. /*----init.c - fassert(find(3,"descriptor"),(Ptr) p_descriptor,-1,0);*/
  6. /*----init.h - ,p_descriptor()                                       */
  7. /*----                                                               */
  8. /*----Needs stdio.h                                                  */
  9. /*----                                                               */
  10. /*----Usage :-descriptor(+Channel,-Descriptor).                      */
  11. /*----                                                               */
  12. /*----Written by Geoff Sutcliffe 7/12/89                             */
  13. /*-------------------------------------------------------------------*/
  14. p_descriptor(t,l)
  15. Ptr t;
  16. levtype l;
  17. {
  18. Ptr     t_channel;
  19. levtype l_channel;
  20. int channel_number;
  21.  
  22. findbind((Ptr)targ(1,t),l,&t_channel,&l_channel);
  23. if (ttype(t_channel) != TNUM)
  24.     {
  25.     plerror(EEINT);
  26.     return(ERROR);
  27.     }
  28.  
  29. findbind((Ptr)targ(2,t),l,&t,&l);
  30. if(ttype(t) != TVAR)
  31.     {
  32.     plerror(EEVAR);
  33.     return(ERROR);
  34.     }
  35.  
  36. channel_number = tnum(t_channel);
  37. if (channel_number < 0 || channel_number >= MAXFILES+MAXDBQ ||
  38. !pfiles[channel_number])
  39.     {
  40.     plerror(EFILE);
  41.     return(ERROR);
  42.     }
  43.  
  44. nbind(t,l,ConsInt(fileno(pfiles[channel_number])));
  45. return(SUCCEED);
  46. }
  47. /*-------------------------------------------------------------------*/
  48.  
  49.